<template>
  <el-dialog
    :title="title"
    :visible="dialogTableVisible"
    @open="openFn"
    @close="closeFn"
    style="text-align: left"
  >
    <div v-if="DetailList.discount">
      <el-row>
        <el-col :span="6" class="right">机器编号:</el-col>
        <el-col :span="6" class="left">{{ DetailList.innerCode }}</el-col>
        <el-col :span="6" class="right">策略折扣:</el-col>
        <el-col :span="6" class="left">{{ DetailList.policyName }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="6" class="right">策略方案:</el-col>
        <el-col :span="6" class="left">{{ `${DetailList.discount}%` }}</el-col>
        <!-- <el-col :span="6" class="right">策略折扣:</el-col> -->
        <!-- <el-col :span="6" class="left">{{ DetailList.policyName }}</el-col> -->
      </el-row>
    </div>
    <div v-else >
      <el-form
        label-width="140px"
      >
        <el-form-item label="策略管理" >
          <el-input v-model="form.policyId" style="width:396px"
          placeholder="请输入"></el-input>
        </el-form-item>

      </el-form>
    </div>
  </el-dialog>
</template>

<script>
// import { detailAreaList } from '@/api/point'
import { VmDetailAPI } from '@/api/vm'
import { getNowTime } from '@/views/Point/index'
export default {
  props: {
    dialogTableVisible: Boolean,
    id: String
  },
  created () {
    // this.title = this.obj.discount ? '策略管理' : '批量策略管理'
  },
  data () {
    return {
      DetailList: [],
      form: {
        policyId: ''
      },
      title: ''
    }
  },

  methods: {
    closeFn () {
      this.$emit('update:dialogTableVisible', false)
    },
    openFn () {
      this.getDetailList()
    },
    async getDetailList () {
      const res = await VmDetailAPI(this.id)
      this.DetailList = res
      res.discount ? (this.title = '策略管理') : (this.title = '批量策略管理')
    }
  },
  filters: {
    getNowTime
  }
}
</script>

<style lang="less" scoped>
/deep/ .el-dialog {
  width: 630px;
  text-align: left;
  font-weight: 700;
  font-size: 16px;
  border-radius: 15px;
  //   height:300 px;
}
/deep/ .el-dialog__body {
  padding: 0px 20px 20px 20px;
}
.right {
  text-align: right;
  font-size: 14px;
  font-weight: normal;
  padding: 10px;
}
.left {
  text-align: left;
  font-size: 14px;
  font-weight: normal;
  padding: 10px;
}
</style>
